package com.snailct.bpp.router;

import com.snailct.bpp.router.api.IServiceRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 服务路由RestApi样式接口
 * @author andy
 */
@SpringBootApplication
@ImportResource("classpath:spring/spring-commons-config.xml")
@ComponentScan(basePackages = "com.snailct.bpp")
@RestController
@EnableAutoConfiguration
public class RouterApplication {
    @Autowired
    @Qualifier("xmlServiceRouter")
    private IServiceRouter serviceRouter;
    @RequestMapping(value = "/component/srouter")
    public String execute(String reqData){
        return serviceRouter.acceptRequest(reqData);
    }
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(RouterApplication.class);
        app.run(args);
    }
}
